home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-16 | 4.5 KB | 187 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWGDIObj.h
- // Release Version: $ ODF 1 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
- #ifdef FW_BUILD_WIN
-
- #ifndef FWGDIOBJ_H
- #define FWGDIOBJ_H
-
- #ifndef SLGRDEF_H
- #include "SLGrDef.h"
- #endif
-
- #ifndef FWGCONST_H
- #include "FWGConst.h"
- #endif
-
- #ifndef FWPAT_H
- #include "FWPat.h"
- #endif
-
- #ifndef PRSHATTR_H
- #include "PRShAttr.h"
- #endif
-
- // ----- Foundation Layer -----
-
- #ifndef FWEXCLIB_H
- #include "FWExcLib.h"
- #endif
-
- //========================================================================================
- // class FW_CPrivWinGDIObjectHandle
- //========================================================================================
-
- class FW_CPrivWinGDIObjectHandle
- {
- public:
- FW_CPrivWinGDIObjectHandle()
- { fObject = NULL; fIsStock = FALSE; }
- FW_CPrivWinGDIObjectHandle(HGDIOBJ hObject, FW_Boolean isStock)
- { fObject = hObject; fIsStock = isStock; }
-
- FW_Boolean operator==(const FW_CPrivWinGDIObjectHandle& other) const
- { return fObject == other.fObject;}
- FW_Boolean operator!=(const FW_CPrivWinGDIObjectHandle& other) const
- { return fObject != other.fObject;}
-
- FW_Boolean operator==(HGDIOBJ GDIObject) const
- { return fObject == GDIObject; }
- FW_Boolean operator!=(HGDIOBJ GDIObject) const
- { return fObject != GDIObject ;}
-
- operator HGDIOBJ() const
- { return fObject; }
-
- HGDIOBJ fObject;
- FW_Boolean fIsStock;
-
- private:
- FW_CPrivWinGDIObjectHandle(const FW_CPrivWinGDIObjectHandle& other);
- FW_CPrivWinGDIObjectHandle& operator=(const FW_CPrivWinGDIObjectHandle& other);
- };
-
- //========================================================================================
- // class FW_CPrivWinGDIObject
- //========================================================================================
-
- class FW_CPrivWinGDIObject
- {
- public:
- FW_DECLARE_AUTO(FW_CPrivWinGDIObject)
-
- FW_CPrivWinGDIObject();
- virtual ~FW_CPrivWinGDIObject();
-
- void SetStockID(int stockID);
-
- void UnselectObject(HDC hdc);
- void SelectObject(HDC hdc);
-
- HGDIOBJ GetObject(HDC hdc);
-
- virtual HGDIOBJ CreateObject() = 0;
-
- private:
- void MakeGDIObject(FW_CPrivWinGDIObjectHandle& GDIObject);
- void DeleteGDIObject(FW_CPrivWinGDIObjectHandle& GDIObject);
-
- protected:
- FW_CPrivWinGDIObjectHandle fGDIObject;
-
- FW_Boolean fChanged;
-
- int fStockID;
- FW_Boolean fStockObject;
-
- HDC fDC;
- HGDIOBJ fPreviousObject;
- };
-
- //========================================================================================
- // class FW_CPrivGDIPen
- //========================================================================================
-
- class FW_CPrivGDIPen : public FW_CPrivWinGDIObject
- {
- public:
- FW_CPrivGDIPen();
- virtual ~FW_CPrivGDIPen();
-
- void SetPenSize(int width);
- void SetPenStyle(FW_EStyleDash dashStyle);
- void SetPenColor(COLORREF color);
-
- virtual HGDIOBJ CreateObject();
-
- int GetPenSize();
-
- private:
- int fWidth;
- FW_EStyleDash fDashStyle;
- COLORREF fColor;
- };
-
- //----------------------------------------------------------------------------------------
- // FW_CPrivGDIBrush::GetPenSize
- //----------------------------------------------------------------------------------------
-
- inline int FW_CPrivGDIPen::GetPenSize()
- {
- return fWidth;
- }
-
- //========================================================================================
- // class FW_CPrivGDIBrush
- //========================================================================================
-
- class FW_CPrivGDIBrush : public FW_CPrivWinGDIObject
- {
- public:
- FW_CPrivGDIBrush();
- virtual ~FW_CPrivGDIBrush();
-
- void SetBrushPattern(const FW_PPrivPattern& pattern);
- void SetBrushColor(COLORREF color);
-
- virtual HGDIOBJ CreateObject();
-
- HBRUSH GetBrush(HDC hdc);
-
- private:
- FW_Boolean fSolidColorBrush;
- COLORREF fColor;
- FW_PPrivPattern fPattern;
- };
-
- //========================================================================================
- // class FW_CPrivGDIFont
- //========================================================================================
-
- class FW_CPrivGDIFont : public FW_CPrivWinGDIObject
- {
- public:
- FW_CPrivGDIFont();
- virtual ~FW_CPrivGDIFont();
-
- void SetFontName(const char* fontName);
- void SetFontStyle(FW_FontStyle fontStyle);
- void SetFontSize(short fontSize);
-
- virtual HGDIOBJ CreateObject();
-
- private:
- char fFontName[LF_FACESIZE];
- FW_FontStyle fFontStyle;
- short fFontSize;
- };
-
- #endif
-
- #endif
-